package org.springframework.samples.petclinic.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;
import javax.validation.constraints.Digits;

import org.hibernate.annotations.Type;
import org.hibernate.validator.constraints.NotEmpty;
import org.joda.time.DateTime;
import org.springframework.format.annotation.DateTimeFormat;

@Entity
@Table(name = "aliens")
// @Inheritance(strategy=InheritanceType.JOINED)
// public class Alien extends Owner implements Cloneable {
public class Alien extends Person implements Cloneable {

	@Column(name = "pack_name")
	private String packName;
	
	@Column(name = "series")
	private int series = 2;
	
	@Column(name = "series_no")
	private int seriesNo;
	
	@Column(name = "series_size")
	private int seriesSize = 5;
	
	@Column(name = "series_pos")
	private int seriesPos;
	
	@Column(name = "thread_id")
	private long threadId;
	
    @Column(name = "insert_date")
    @Type(type = "org.jadira.usertype.dateandtime.joda.PersistentDateTime")
//    @DateTimeFormat(pattern = "yyyy/MM/dd")
    private DateTime insertDate;
    
    @Column(name = "after_insert_sleep")
    private long afterInsertSleep = 0;
    
    @Column(name = "after_series_sleep")
    private long afterSeriesSleep = 0;
    
    @Override
    public Object clone() {
        try {
            return super.clone();
        } catch (CloneNotSupportedException e) {
            throw new RuntimeException(e);
        }
    }
    
	public String getPackName() {
		return packName;
	}
	public void setPackName(String packName) {
		this.packName = packName;
	}
	public int getSeries() {
		return series;
	}
	public void setSeries(int series) {
		this.series = series;
	}
	public int getSeriesNo() {
		return seriesNo;
	}
	public void setSeriesNo(int seriesNo) {
		this.seriesNo = seriesNo;
	}
	public int getSeriesSize() {
		return seriesSize;
	}
	public void setSeriesSize(int seriesSize) {
		this.seriesSize = seriesSize;
	}
	public int getSeriesPos() {
		return seriesPos;
	}
	public void setSeriesPos(int seriesPos) {
		this.seriesPos = seriesPos;
	}
	public long getThreadId() {
		return threadId;
	}
	public void setThreadId(long threadId) {
		this.threadId = threadId;
	}
	public DateTime getInsertDate() {
		return insertDate;
	}
	public void setInsertDate(DateTime insertDate) {
		this.insertDate = insertDate;
	}
    public long getAfterInsertSleep() {
        return afterInsertSleep;
    }
    public void setAfterInsertSleep(long afterInsertSleep) {
        this.afterInsertSleep = afterInsertSleep;
    }
    public long getAfterSeriesSleep() {
        return afterSeriesSleep;
    }
    public void setAfterSeriesSleep(long afterSeriesSleep) {
        this.afterSeriesSleep = afterSeriesSleep;
    }

    @Override
    public String toString() {
        return "Alien [packName=" + packName + ", series=" + series + ", seriesNo=" + seriesNo + ", seriesSize=" + seriesSize + ", seriesPos=" + seriesPos
                + ", threadId=" + threadId + ", insertDate=" + insertDate + ", afterInsertSleep=" + afterInsertSleep + ", afterSeriesSleep=" + afterSeriesSleep
                + ", getId()=" + getId() + "]";
    }
    
  
}
